/*河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
*/
package cn.javaxc.oa.action.humanresources;
import java.io.*;
import java.util.*;
import java.sql.*;
import cn.javaxc.model.base.SQL;
import cn.javaxc.model.base.SQLList;
import cn.javaxc.model.base.SQLMap;
import cn.javaxc.model.base.SQLParam;
import cn.javaxc.model.page.BatisPage;
import cn.javaxc.mvcwork.controller.web.TreeBean;
import cn.javaxc.mvcwork.util.common.CommonUtil;
import cn.javaxc.mvcwork.util.common.MapListUtil;
import cn.javaxc.mvcwork.util.helper.FrameHelper;
import cn.javaxc.mvcwork.util.helper.TreeTableHelper;
import org.springframework.beans.factory.annotation.Autowired;
import cn.javaxc.system.action.base.BaseAction;
import cn.javaxc.oa.mapper.humanresources.EmployeeMapper;
public class EmployeeAction extends BaseAction
{
    @Autowired(required=false)
	private EmployeeMapper mapper;
    /**
    员工统计图
    */
    
    public Map cartogramStaff() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        TreeBean tb;
        
        tb = createTreeBean("s_firm_treecols");
        SQLList<SQLMap> s_firm=mapper.s_firm(params);
        s_firm = s_firm.buildTree(tb,tb.getPid());
        result.put("s_firm", s_firm);
        
        return result;
    }
    /**
    员工列表
    */
    
    public Map staffList() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        TreeBean tb;
        
        tb = createTreeBean("s_firm_treecols");
        SQLList<SQLMap> s_firm=mapper.s_firm(params);
        s_firm = s_firm.buildTree(tb,tb.getPid());
        result.put("s_firm", s_firm);
        
        return result;
    }
    /**
    */
    
    public Object s_user() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_user=mapper.s_user(params,pagination);
        s_user.setPagedListInfo(pagination);
        result.put("s_user", s_user);
        
        return s_user;
    }
    /**
    */
    
    public Map s_outline() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_outline=mapper.s_outline(params);
        result.put("s_outline", s_outline);
        
        return result;
    }
    /**
    基本信息
    */
    
    public Map staffDet() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> person_info=mapper.person_info(params);
        result.put("person_info", person_info);
        
        
        SQLList<SQLMap> s_relation=mapper.s_relation(params);
        SQLMap s_relation_emt=s_relation.getExistfirst();
        result.put("s_relation", s_relation_emt);
        
        
        SQLList<SQLMap> s_file=mapper.s_file(params);
        SQLMap s_file_emt=s_file.getExistfirst();
        result.put("s_file", s_file_emt);
        
        
        SQLList<SQLMap> s_access=mapper.s_access(params);
        SQLMap s_access_emt=s_access.getExistfirst();
        result.put("s_access", s_access_emt);
        
        return result;
    }
    /**
    修改
    */
    
    public Map staffUp() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        TreeBean tb;
        
        SQLList<SQLMap> person_info=mapper.person_info(params);
        SQLMap person_info_emt=person_info.getExistfirst();
        result.put("person_info", person_info_emt);
        
        
        SQLList<SQLMap> l_pf=mapper.l_pf(params);
        result.put("l_pf", l_pf);
        
        
        SQLList<SQLMap> s_relation=mapper.s_relation(params);
        SQLMap s_relation_emt=s_relation.getExistfirst();
        result.put("s_relation", s_relation_emt);
        
        
        SQLList<SQLMap> l_pt=mapper.l_pt(params);
        result.put("l_pt", l_pt);
        
        
        SQLList<SQLMap> s_role=mapper.s_role(params);
        result.put("s_role", s_role);
        
        
        SQLList<SQLMap> s_access=mapper.s_access(params);
        result.put("s_access", s_access);
        
        
        SQLList<SQLMap> l_station=mapper.l_station(params);
        result.put("l_station", l_station);
        
        
        SQLList<SQLMap> s_person=mapper.s_person(params);
        SQLMap s_person_emt=s_person.getExistfirst();
        result.put("s_person", s_person_emt);
        
        
        tb = createTreeBean("s_firm_treecols");
        SQLList<SQLMap> s_firm=mapper.s_firm(params);
        s_firm = s_firm.buildTree(tb,tb.getPid());
        result.put("s_firm", s_firm);
        
        return result;
    }
    /**
    增加
    */
    
    public Map staffAdd() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        TreeBean tb;
        
        SQLList<SQLMap> l_pf=mapper.l_pf(params);
        result.put("l_pf", l_pf);
        
        
        SQLList<SQLMap> l_pt=mapper.l_pt(params);
        result.put("l_pt", l_pt);
        
        
        SQLList<SQLMap> t_firm=mapper.t_firm(params);
        SQLMap t_firm_emt=t_firm.getExistfirst();
        result.put("t_firm", t_firm_emt);
        
        
        SQLList<SQLMap> s_role=mapper.s_role(params);
        result.put("s_role", s_role);
        
        
        SQLList<SQLMap> s_access=mapper.s_access(params);
        result.put("s_access", s_access);
        
        
        
        
        SQLList<SQLMap> l_station=mapper.l_station(params);
        result.put("l_station", l_station);
        
        
        tb = createTreeBean("s_firm_treecols");
        SQLList<SQLMap> s_firm=mapper.s_firm(params);
        s_firm = s_firm.buildTree(tb,tb.getPid());
        result.put("s_firm", s_firm);
        
        return result;
    }
    /**
    岗位
    */
    
    public Map staffStation() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> t_user=mapper.t_user(params);
        SQLMap t_user_emt=t_user.getExistfirst();
        result.put("t_user", t_user_emt);
        
        
        SQLList<SQLMap> station_info=mapper.station_info(params);
        SQLMap station_info_emt=station_info.getExistfirst();
        result.put("station_info", station_info_emt);
        
        
        SQLList<SQLMap> person_info=mapper.person_info(params);
        SQLMap person_info_emt=person_info.getExistfirst();
        result.put("person_info", person_info_emt);
        
        return result;
    }
    /**
    分配岗位
    */
    
    public Map staffStationDis() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> station_set=mapper.station_set(params);
        SQLMap station_set_emt=station_set.getExistfirst();
        result.put("station_set", station_set_emt);
        
        
        
        return result;
    }
    /**
    多岗位
    */
    
    public Map multiStation() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        TreeBean tb;
        
        tb = createTreeBean("pmslist_treecols");
        tb.setPrefix("img");
        SQLList<SQLMap> pmslist=mapper.pmslist(params);
        pmslist = pmslist.buildTree(tb,tb.getPid());
        result.put("pmslist", pmslist);
        
        return result;
    }
    /**
    登录记录
    */
    
    public Map staffRegister() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_access=mapper.s_access(params);
        SQLMap s_access_emt=s_access.getExistfirst();
        result.put("s_access", s_access_emt);
        
        
        SQLList<SQLMap> s_relation=mapper.s_relation(params);
        SQLMap s_relation_emt=s_relation.getExistfirst();
        result.put("s_relation", s_relation_emt);
        
        return result;
    }
    /**
    修改登录信息
    */
    
    public Map staffRegisterInfoUp() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s1_access=mapper.s1_access(params);
        SQLMap s1_access_emt=s1_access.getExistfirst();
        result.put("s1_access", s1_access_emt);
        
        return result;
    }
    /**
    修改邮箱密码
    */
    
    public Map staffRegisterEmailPassUp() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_relation=mapper.s_relation(params);
        SQLMap s_relation_emt=s_relation.getExistfirst();
        result.put("s_relation", s_relation_emt);
        
        return result;
    }
    /**
    我的信息
    */
    
    public Map staffMyselfDet() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> person_info=mapper.person_info(params);
        SQLMap person_info_emt=person_info.getExistfirst();
        result.put("person_info", person_info_emt);
        
        
        SQLList<SQLMap> s_relation=mapper.s_relation(params);
        SQLMap s_relation_emt=s_relation.getExistfirst();
        result.put("s_relation", s_relation_emt);
        
        
        SQLList<SQLMap> s_file=mapper.s_file(params);
        SQLMap s_file_emt=s_file.getExistfirst();
        result.put("s_file", s_file_emt);
        
        return result;
    }
    /**
    修改我的信息
    */
    
    public Map staffMyselfUp() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> person_info=mapper.person_info(params);
        SQLMap person_info_emt=person_info.getExistfirst();
        result.put("person_info", person_info_emt);
        
        
        SQLList<SQLMap> l_pf=mapper.l_pf(params);
        result.put("l_pf", l_pf);
        
        
        SQLList<SQLMap> s_relation=mapper.s_relation(params);
        SQLMap s_relation_emt=s_relation.getExistfirst();
        result.put("s_relation", s_relation_emt);
        
        
        SQLList<SQLMap> l_pt=mapper.l_pt(params);
        result.put("l_pt", l_pt);
        
        
        SQLList<SQLMap> l_station=mapper.l_station(params);
        result.put("l_station", l_station);
        
        return result;
    }
    /**
    面试通过人员列表
    */
    
    public Map interviewAdoptList() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> p_person=mapper.p_person(params,pagination);
        p_person.setPagedListInfo(pagination);
        result.put("p_person", p_person);
        
        return result;
    }
    /**
    录用员工
    */
    
    public Map staffEmployment() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_firmlist=mapper.s_firmlist(params);
        SQLMap s_firmlist_emt=s_firmlist.getExistfirst();
        result.put("s_firmlist", s_firmlist_emt);
        
        
        SQLList<SQLMap> s_firmlist1=mapper.s_firmlist1(params);
        SQLMap s_firmlist1_emt=s_firmlist1.getExistfirst();
        result.put("s_firmlist1", s_firmlist1_emt);
        
        
        SQLList<SQLMap> s_access=mapper.s_access(params);
        result.put("s_access", s_access);
        
        
        SQLList<SQLMap> s_person=mapper.s_person(params);
        result.put("s_person", s_person);
        
        
        SQLList<SQLMap> s_firm=mapper.s_firm(params);
        result.put("s_firm", s_firm);
        
        
        SQLList<SQLMap> s_dept=mapper.s_dept(params);
        result.put("s_dept", s_dept);
        
        
        SQLList<SQLMap> s_role=mapper.s_role(params);
        result.put("s_role", s_role);
        
        
        SQLList<SQLMap> l_pf=mapper.l_pf(params);
        result.put("l_pf", l_pf);
        
        
        SQLList<SQLMap> l_pt=mapper.l_pt(params);
        result.put("l_pt", l_pt);
        
        
        SQLList<SQLMap> l_station=mapper.l_station(params);
        result.put("l_station", l_station);
        
        
        SQLList<SQLMap> l_person=mapper.l_person(params);
        SQLMap l_person_emt=l_person.getExistfirst();
        result.put("l_person", l_person_emt);
        
        
        
        return result;
    }
    /**
    */
    
    public Map d_person() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_person(params);
        
        return result;
    }
    /**
    */
    
    public Map disable() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.disable(params);
        
        return result;
    }
    /**
    */
    
    public Map restore() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.restore(params);
        
        return result;
    }
    /**
    修改修改
    */
    
    public Map staffUpSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object per_relation_cnt =
        mapper.per_relation_cnt(params);
        result.put("per_relation_cnt", per_relation_cnt);
        
        
        mapper.staffUpSubmit(params);
        
        
        
        return result;
    }
    /**
    增加修改
    */
    
    public Map staffAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int CMID = mapper.CMID(params);
        result.put("CMID", CMID);
        
        
        params.put("password",SQL.md5(getParameter("password"),"123456"));
        int I_access = mapper.I_access(params);
        result.put("I_access", I_access);
        
        return result;
    }
    /**
    多岗位修改
    */
    
    public Map multiStationSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.multiStationSubmit(params);
        
        return result;
    }
    /**
    修改登录信息修改
    */
    
    public Map staffRegisterInfoUpSubmit() throws Exception {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        String password =!SQL.isNull(getParameter("password"))?getParameter("password"):"true".equals(getParameter("is_rand"))?SQL.setRandom(6):"123456";
        request.setAttribute("password", password);
        
        
        params.put("password",SQL.md5(password,null));
        mapper.staffRegisterInfoUpSubmit(params);
        
        
        SQLList<SQLMap> s_access=mapper.s_access(params);
        SQLMap s_access_emt=s_access.getExistfirst();
        result.put("s_access", s_access_emt);
        
        
        if("true".equals(context.getParameter("is_mail"))){
            cn.javaxc.mvcwork.controller.AppUtils.newPassword(context,s_access_emt,password);
        }
        
        return result;
    }
    /**
    修改邮箱密码修改
    */
    
    public Map staffRegisterEmailPassUpSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.staffRegisterEmailPassUpSubmit(params);
        
        return result;
    }
    /**
    修改我的信息修改
    */
    
    public Map staffMyselfUpSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object per_relation_cnt =
        mapper.per_relation_cnt(params);
        result.put("per_relation_cnt", per_relation_cnt);
        
        
        mapper.staffMyselfUpSubmit(params);
        
        return result;
    }
    /**
    增加公司修改
    */
    
    public Map staffCompanyAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int CMID1 = mapper.CMID1(params);
        result.put("CMID1", CMID1);
        
        return result;
    }
    /**
    增加部门修改
    */
    
    public Map staffDeptAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int CMID2 = mapper.CMID2(params);
        result.put("CMID2", CMID2);
        
        return result;
    }
    /**
    录用员工修改
    */
    
    public Map staffEmploymentSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        params.put("password",SQL.md5(getParameter("password"),"123456"));
        int CMID = mapper.CMID(params);
        result.put("CMID", CMID);
        
        
        int u_person = mapper.u_person(params);
        result.put("u_person", u_person);
        
        return result;
    }
    public Map staffAjax(){
        String sql="";
        String pagesql="";
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        if(request.getParameter("cfield_name").contains("role_id")){
            SQLList<SQLMap> role_id=mapper.role_id(params);
            result.put("role_id", role_id);
        }
        
        return result;
    }
    public Map ajaxList(){
        String sql="";
        String pagesql="";
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        if(request.getParameter("cfield_name").contains("role_id")){
            SQLList<SQLMap> role_id=mapper.role_id(params);
            result.put("role_id", role_id);
        }
        
        return result;
    }
    public String ajaxComplete(){
        String sql="";
        String pagesql="";
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        return AJAXCOMPLETE;
    }
}